package homework7;

import java.util.ArrayList;
import java.util.List;

public class PetShop<T extends Pet> {
    private List<T> pets;

    public PetShop() {
        pets = new ArrayList<>();
    }

    public void addPet(T pet) {
        pets.add(pet);
    }

    public void buyPet(int index) {
        T pet = pets.remove(index);
        System.out.println("你买了一只 " + pet.getType() + " 名字是: " + pet.getName());
    }

}
